package systeme_reservation;

import input_output.Chargement;
import input_output.Sauvegarde;

import java.io.IOException;
import java.util.List;
import polytech.*;

/**
 * Classe main du projet
 * @author Hadrien Luttiau and Nancy Fong
 *
 */
public class Main {

	public static void main(String[] args) {
		List<Batiment> list_bat = null;
		Reservation planning = null;
		Sauvegarde save = new Sauvegarde();
		Chargement load = new Chargement();
		
		boolean CHARGEMENT_TXT = true;			// Permet de choisir le mode de chargement

		// Chargement des batiments
		try {
			list_bat = load.charger_bat();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

		if(CHARGEMENT_TXT){						// Chargement du planning ( version txt )
			try {
				planning = load.charger_res2();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		else{									// Chargement du planning ( version dat )
			try {
				planning = load.charger_res();
			} catch (ClassNotFoundException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		
		// Lancement de l'interface
		Interface view = new Interface();
		view.affiche(planning, list_bat, save);
	}
}
